package net.lbtech;

import junit.framework.TestCase;
import net.lbtech.service.GetWeather;
import net.lbtech.util.CityInitUtil;

/**
 * Created by Administrator on 2016/12/5 0005.
 */
public class WifiGetWeather extends TestCase {


    public void testNum(){
        byte[] b =IntToByteArray(565);
        System.out.println();
        for (int i = 0; i < b.length ; i++) {
            System.out.println(b[i]);
        }
    }


    public static String toHex(byte b) {
        String result = Integer.toHexString(b & 0xFF);
        if (result.length() == 1) {
            result = '0' + result;
        }
        return result;
    }
    public void testHex4(){
        byte b=125;
        System.out.println(toHex(b));
    }

    public static byte[] intToBytes( int value )
    {
        byte[] src = new byte[4];
        src[3] =  (byte) ((value>>24) & 0xFF);
        src[2] =  (byte) ((value>>16) & 0xFF);
        src[1] =  (byte) ((value>>8) & 0xFF);
        src[0] =  (byte) (value & 0xFF);
        return src;
    }

    public byte[] IntToByteArray(int n) {
        byte[] b = new byte[4];
        b[0] = (byte) (n & 0xff);
        b[1] = (byte) (n >> 8 & 0xff);
        b[2] = (byte) (n >> 16 & 0xff);
        b[3] = (byte) (n >> 24 & 0xff);
        return b;
    }

    public  void testIf(){
        byte a = (byte)0xF5;
        byte b = 0x03;
        System.out.println(b);
        if (b == 0x03 && a == (byte)0xF5) {
            System.out.println("OK");
        }
    }
    

}
